<?php

/**
 * MaterialsUsed form base class.
 *
 * @method MaterialsUsed getObject() Returns the current form's model object
 *
 * @package    Porba
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMaterialsUsedForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'order_id'    => new sfWidgetFormInputHidden(),
      'part_number' => new sfWidgetFormInputHidden(),
      'name'        => new sfWidgetFormInputText(),
      'type'        => new sfWidgetFormInputText(),
      'required'    => new sfWidgetFormInputText(),
      'used'        => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'order_id'    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('order_id')), 'empty_value' => $this->getObject()->get('order_id'), 'required' => false)),
      'part_number' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('part_number')), 'empty_value' => $this->getObject()->get('part_number'), 'required' => false)),
      'name'        => new sfValidatorString(array('max_length' => 255)),
      'type'        => new sfValidatorString(array('max_length' => 255)),
      'required'    => new sfValidatorInteger(),
      'used'        => new sfValidatorInteger(),
    ));

    $this->widgetSchema->setNameFormat('materials_used[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MaterialsUsed';
  }

}
